package com.example.springbootoauth2jwtclientserver.exception;

import org.springframework.http.HttpStatus;

public class CustomException extends RuntimeException{
    private int code;
    private String message;
    private Object data;

    public CustomException() {
    }

    public CustomException(CustomExceptionType type,String message) {
        this.code = type.getCode();
        this.message = message;
    }

    public CustomException(CustomExceptionType type,String message, Object data) {
        this.code = type.getCode();
        this.message = message;
        this.data = data;
    }

    public CustomException(HttpStatus httpStatus,String message) {
        this.code = httpStatus.value();
        this.message = message;
    }

    public CustomException(HttpStatus httpStatus,String message, Object data) {
        this.code = httpStatus.value();
        this.message = message;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public Object getData() {
        return data;
    }
}
